package com.handler;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;

import com.bstek.bdf2.core.context.ContextHolder;
import com.bstek.uflo.env.EnvironmentProvider;

@Component
public class UfloSampleEnvironmentProvider implements EnvironmentProvider {

	@Autowired
	private SessionFactory sessionFactory;

	@Autowired
	private PlatformTransactionManager platformTransactionManager;

	@Override
	public String getCategoryId() {
		return null;
	}

	@Override
	public String getLoginUser() {
		return ContextHolder.getLoginUserName();
	}

	@Override
	public PlatformTransactionManager getPlatformTransactionManager() {
		return platformTransactionManager;
	}

	@Override
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setPlatformTransactionManager(PlatformTransactionManager platformTransactionManager) {
		this.platformTransactionManager = platformTransactionManager;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

}
